Upgrade msw-storybook-addon to v3 and msw to 2.15.0 - #1230
Merged
Conversation
dgee2
force-pushed
the
deps-msw-storybook-addon-major
branch
from
August 13, 2026 21:45
7f9db45 to
3e67f50
Compare
dgee2
marked this pull request as ready for review
August 14, 2026 20:46
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the frontend’s Storybook/MSW mocking stack by bumping msw-storybook-addon to v3 and msw to 2.15.0, updating Storybook preview/stories to the new v3 registration pattern so interaction tests reliably exercise mocked API responses.
Changes:
- Upgrade
mswandmsw-storybook-addon, removing the prior pnpm override that pinnedmsw. - Migrate Storybook MSW setup from
initialize()/mswLoader+parameters.mswtoaddonMsw(setupWorker)+ per-storybeforeEach({ msw }) { msw.use(...) }. - Fix Storybook MSW fixtures to match the app’s expected recipe list shape (
titleand numericid), and update the generatedmockServiceWorker.jsto MSW 2.15.0.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui/menu-website/tsconfig.storybook.json | Adds MSW addon types for Storybook typechecking (currently drops Node types; see comment). |
| ui/menu-website/.storybook/preview.ts | Switches to MSW v2 + addon v3 initialization via setupWorker and addonMsw, and registers global handlers via beforeEach. |
| ui/menu-website/.storybook/msw-handlers.ts | Updates mocked recipe list fixtures to use title and numeric id. |
| ui/menu-website/src/pages/RecipeList.stories.ts | Migrates MSW handler registration to per-story beforeEach and tightens assertions to validate mocked data is rendered. |
| ui/menu-website/src/pages/RecipeDetail.stories.ts | Same per-story MSW migration and asserts on mocked recipe title. |
| ui/menu-website/src/components/organisms/recipe/new-recipe-form.stories.ts | Migrates POST handlers to per-story beforeEach for submit success/failure stories. |
| ui/menu-website/.storybook/main.ts | (Indirectly impacted) Includes msw-storybook-addon in addons list. |
| ui/menu-website/package.json | Bumps msw and msw-storybook-addon versions. |
| ui/menu-website/pnpm-workspace.yaml | Removes the msw override now that addon v3 supports newer MSW internals. |
| ui/menu-website/pnpm-lock.yaml | Lockfile updates reflecting the dependency bumps. |
| ui/menu-website/public/mockServiceWorker.js | Updates the generated MSW service worker to 2.15.0. |
| AGENTS.md | Updates documented Storybook/MSW guidance to the v3 handler registration pattern. |
Files not reviewed (1)
- ui/menu-website/pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dgee2
force-pushed
the
deps-msw-storybook-addon-major
branch
from
August 14, 2026 20:57
3e67f50 to
532765c
Compare
Bumps msw-storybook-addon 2.0.6 -> 3.0.0 and msw 2.12.14 -> 2.15.0
(these move together; msw-storybook-addon@2.0.6 is incompatible with
msw's newer worker internals, which is why Group 1 pinned msw down
via a pnpm override). Removes that override now that the addon
supports current msw.
msw-storybook-addon v3 removes `initialize()`/`mswLoader` in favor of
a `definePreview`-style `addons: [addonMsw(setupFn)]` call, and drops
`parameters.msw` support for CSF Next (this project's story format)
in favor of a `beforeEach({ msw }) { msw.use(handler) }` hook per
story. Updated .storybook/preview.ts and the three story files that
registered handlers accordingly.
This also surfaced and fixed two pre-existing, MSW-adjacent problems
that AGENTS.md had documented as "not currently reliable":
- MSW genuinely wasn't intercepting requests under
`vitest --project=storybook` before (confirmed by probing — a
stricter assertion against a previously "passing" story failed
until the beforeEach migration). It works correctly now; updated
AGENTS.md's component-testing guidance to match and removed the
workaround comments in the affected story files.
- .storybook/msw-handlers.ts's recipe list fixtures used `name`
instead of the real API's `title` field, which had gone unnoticed
because MSW wasn't actually serving the response before.
Verified: lint, build, unit tests (57/57), storybook interaction
tests (78/78, now genuinely exercising mocked responses rather than
incidentally matching a fallback UI state), and a dev-server smoke
check. Playwright e2e (`pnpm run test:e2e`) fails, but on an
unrelated pre-existing stale scaffold assertion ("You did it!") that
doesn't match this app's actual content and is unmodified from main.
Co-authored-by: Claude <noreply@anthropic.com>
dgee2
force-pushed
the
deps-msw-storybook-addon-major
branch
from
August 14, 2026 21:12
532765c to
ce06b5a
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Bumps msw-storybook-addon 2.0.6 -> 3.0.0 and msw 2.12.14 -> 2.15.0
(these move together; msw-storybook-addon@2.0.6 is incompatible with
msw's newer worker internals, which is why Group 1 pinned msw down
via a pnpm override). Removes that override now that the addon
supports current msw.
msw-storybook-addon v3 removes
initialize()/mswLoaderin favor ofa
definePreview-styleaddons: [addonMsw(setupFn)]call, and dropsparameters.mswsupport for CSF Next (this project's story format)in favor of a
beforeEach({ msw }) { msw.use(handler) }hook perstory. Updated .storybook/preview.ts and the three story files that
registered handlers accordingly.
This also surfaced and fixed two pre-existing, MSW-adjacent problems
that AGENTS.md had documented as "not currently reliable":
vitest --project=storybookbefore (confirmed by probing — astricter assertion against a previously "passing" story failed
until the beforeEach migration). It works correctly now; updated
AGENTS.md's component-testing guidance to match and removed the
workaround comments in the affected story files.
nameinstead of the real API's
titlefield, which had gone unnoticedbecause MSW wasn't actually serving the response before.
Verified: lint, build, unit tests (57/57), storybook interaction
tests (78/78, now genuinely exercising mocked responses rather than
incidentally matching a fallback UI state), and a dev-server smoke
check. Playwright e2e (
pnpm run test:e2e) fails, but on anunrelated pre-existing stale scaffold assertion ("You did it!") that
doesn't match this app's actual content and is unmodified from main.
Co-authored-by: Claude noreply@anthropic.com
Stack created with GitHub Stacks CLI • Give Feedback 💬